/*
 * Copyright 1999-2004 Alibaba.com All right reserved. This software is the confidential and proprietary information of
 * Alibaba.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with Alibaba.com.
 */
package action.expr;

/**
 * ��ʾaction���ʽ�˷���������е�һ��token
 * 
 * @author pf-miles 2011-6-17 ����05:16:37
 */
public class ActionToken {

    private ActionTokenType type;
    private String value;

    /**
     * @param type
     * @param value
     */
    public ActionToken(ActionTokenType type, String value) {
        super();
        this.type = type;
        this.value = value;
    }

    public ActionTokenType getType() {
        return type;
    }

    public void setType(ActionTokenType type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((type == null) ? 0 : type.hashCode());
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ActionToken other = (ActionToken) obj;
        if (type == null) {
            if (other.type != null)
                return false;
        } else if (!type.equals(other.type))
            return false;
        if (value == null) {
            if (other.value != null)
                return false;
        } else if (!value.equals(other.value))
            return false;
        return true;
    }

    public String toString() {
        return "[" + type + ", " + value + "]";
    }
}
